# Maintainer: Celeste <cielesti@protonmail.com>
maintainer="Celeste <cielesti@protonmail.com>"
pkgname=emacs-gnosis
pkgver=0.3.2
pkgrel=0
_pkgreal=gnosis
pkgdesc="Spaced Repetition System for GNU Emacs"
url="https://thanosapollo.org/projects/gnosis/"
arch="noarch"
license="GPL-3.0-or-later"
depends="
	cmd:emacs
	cmd:git
	emacs-compat
	emacs-emacsql-sqlite
	"
makedepends="emacs-nox"
source="$pkgname-$pkgver.el::https://git.thanosapollo.org/gnosis/plain/gnosis.el?h=$pkgver
	$pkgname-algorithm-$pkgver.el::https://git.thanosapollo.org/gnosis/plain/gnosis-algorithm.el?h=$pkgver
	$pkgname-string-edit-$pkgver.el::https://git.thanosapollo.org/gnosis/plain/gnosis-string-edit.el?h=$pkgver
	"
options="!check" # no tests provided

unpack() {
	mkdir -vp "$builddir"
	cd "$builddir"

	cp -v "$srcdir/$pkgname-$pkgver.el" ./gnosis.el
	cp -v "$srcdir/$pkgname-algorithm-$pkgver.el" ./gnosis-algorithm.el
	cp -v "$srcdir/$pkgname-string-edit-$pkgver.el" ./gnosis-string-edit.el
}

build() {
	emacs -batch -q -no-site-file -L . \
		-f batch-byte-compile \
		./*.el
}

package() {
	install -Dvm644 ./*.el ./*.elc \
		-t "$pkgdir"/usr/share/emacs/site-lisp/$_pkgreal/

	cd "$pkgdir"/usr/share/emacs/site-lisp/$_pkgreal
	emacs -batch -q -no-site-file \
		-eval "(loaddefs-generate \".\" \"$_pkgreal-loaddefs.el\")"
}

sha512sums="
8bb2732a9f286c5335287e28f9dbc177ae25c7b0ad1e8391583bf08ce7e132a64bad7192b766498c0241fb947c13de4a9ebf20f95ba48e72e9a926a09e5713ab  emacs-gnosis-0.3.2.el
54ef9d88ae290b73e074c8685376e0716c1bb53d577fb5bca9e47dc640ffbe877a2292b00464b25630fbcdec286a2fd2c9d96e66c42a140dc52a64f8b645eb2b  emacs-gnosis-algorithm-0.3.2.el
65bfc34feb31446fcece349432305740996f969e0b8eddb137c3fec9e94f1dbcf270eb75d5a7ee0aa6627e7cb209b0cf86530a8cf719968be97be7edeb35ffcb  emacs-gnosis-string-edit-0.3.2.el
"
